<html  xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>财富管家X-管理员</title>
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="shortcut icon" th:href="@{images/littlelogo.png}" >
  <link rel="icon" th:href="@{/favicon.ico}"  mce_href="/favicon.ico" type="image/x-icon"/>
  <link rel="stylesheet" th:href="@{/css/font.css}">
  <link rel="stylesheet" th:href="@{/css/xadmin.css}">
  <script type="text/javascript" th:src="@{/js/jquery-3.2.1.min.js}"></script>
  <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
  <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>

  <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  <!--[if lt IE 9]>
  <script th:src="@{/js/html5.min.js}" type="text/javascript"></script>
  <script th:src="@{/js/respond.min.js}" type="text/javascript"></script>
  <![endif]-->
</head>
  
  <body class="layui-anim layui-anim-up">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">用户管理</a>
        <a>
          <cite>用户实名</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
        <span class="x-right" style="line-height:40px">共有数据：88 条</span>
      <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>姓名</th>
            <th>身份证</th>
            <th>状态</th>
            <th>操作</th></tr>
        </thead>
        <tbody>
          <tr th:each="list:${lists}">
            <td th:text="${list.id}">1</td>
            <td th:text="${list.name}">小明</td>
            <td th:text="${list.IDcard}"></td>
            <td class="td-status">
              <dl th:if="${list.status}==2">
                <span class="layui-btn layui-btn-normal layui-btn-mini" style="background: #55a532;">已审核</span>
              </dl>
              <dl th:if="${list.status}==1">
                <span class="layui-btn layui-btn-normal layui-btn-mini" style="background: red;">待审核</span>
              </dl>
              <dl th:if="${list.status}==0">
                <span class="layui-btn layui-btn-normal layui-btn-mini" style="background: #df5000;">未认证</span>
              </dl>
            </td>
            <td class="td-manage">
              <dl th:if="${list.status}==1">
                <a th:onclick="'javascript:member_start('+this+','+${list.id}+')'" href="javascript:;"  title="通过">
                  <i class="layui-icon">&#xe62f;</i>
                </a>
              </dl>

              <dl th:if="${list.status}==1">
                <a th:onclick="'javascript:member_stop('+this+','+${list.id}+')'" href="javascript:;"  title="驳回">
                  <i class="layui-icon">&#xe601;</i>
                </a>
              </dl>
            </td>
          </tr>
        </tbody>
      </table>
      <div class="page">
        <div id="pagination"></div>
      </div>

    </div>
    <script>
      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });

      /*用户-通过*/
      function member_start(obj,id){
          layer.confirm('确认要通过吗？',function(index){
              //异步把用户状态进行更改
              var data={
                  status:2,
                  id:id
              }
              $.ajax({
                  type:'POST',
                  url:contextPath + '/user/upStatus',
                  data:data,
                  async:false,
                  success:function (data) {
                      if ($(obj).attr('title')=='通过'){
                          layer.msg('已审核!',{icon: 6,time:1000});
                          location.reload(true);
                      }
                  }
              })
          });
      }

      /*用户-驳回*/
      function member_stop(obj,id){
          layer.confirm('确认要驳回吗？',function(index){
              //异步把用户状态进行更改
              var data={
                  status:0,
                  id:id
              }
              $.ajax({
                  type:'POST',
                  url:contextPath + '/user/upStatus',
                  data:data,
                  async:false,
                  success:function (data) {
                      if ($(obj).attr('title')=='驳回'){
                          layer.msg('未审核!',{icon: 5,time:1000});
                          location.reload(true);
                      }
                  }
              })
          });
      }

    </script>
    <script th:inline="javascript">
        /*<![CDATA[*/
        var count = [[${count}]];//总记录数
        var curr = [[${curr}]];//当前页
        var contextPath = [[${#request.getContextPath()}]]; //获取当前应用路径
        // var username = [[${keyword}]]
        /*]]>*/


    </script>
    <script type="text/javascript">
        function look(id){
            console.log(id)
            parent.layer.open({
                title: 'layer mobile页',
                shadeClose: true,
                content:contextPath+ '/user/list?crowdId='+id
            });
        }

        layui.use('laypage', function(){
            var laypage = layui.laypage;

            //执行一个laypage实例
            laypage.render({
                elem: 'pagination' //注意，这里的 data 是 ID，不用加 # 号
                ,count: count //数据总数，从服务端得到
                ,curr: curr
                // ,username: username
                ,limit: 5
                ,jump: function(obj, first){
                    //obj包含了当前分页的所有参数，比如：
                    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    console.log(obj.limit); //得到每页显示的条数
                    //首次不执行
                    if(!first){
                        // window.location.href = contextPath + "/chat?page=" + (obj.curr) + "&size=" + obj.limit+ "&keyword=" + obj.username
                        window.location.href = contextPath + "/user/list?page=" + (obj.curr) + "&size=" + obj.limit
                    }
                }
            });
        });
    </script>
  </body>

</html>